import 'package:flutter_test/flutter_test.dart';
import 'package:mpaas/mpaas.dart';
import 'package:mpaas/mpaas_platform_interface.dart';
import 'package:mpaas/mpaas_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockMpaasPlatform
    with MockPlatformInterfaceMixin
    implements MpaasPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
  
  @override
  Future<bool> pushBindUserId(String userId) {
    // TODO: implement pushBindUserId
    throw UnimplementedError();
  }
  
  @override
  Future<String?> pushGetToken() {
    // TODO: implement pushGetToken
    throw UnimplementedError();
  }
}

void main() {
  final MpaasPlatform initialPlatform = MpaasPlatform.instance;

  test('$MethodChannelMpaas is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelMpaas>());
  });

  test('getPlatformVersion', () async {
    Mpaas mpaasPlugin = Mpaas();
    MockMpaasPlatform fakePlatform = MockMpaasPlatform();
    MpaasPlatform.instance = fakePlatform;

    expect(await mpaasPlugin.getPlatformVersion(), '42');
  });
}
